﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;
using System.Windows.Media;
using Styx;
using Styx.Helpers;
using Styx.Common;
using Styx.CommonBot.POI;
using Styx.CommonBot;
using Styx.CommonBot.Routines;
using Styx.Pathing;
using Styx.WoWInternals;
using Styx.WoWInternals.WoWObjects;

namespace ElementalMyDear
{
    public partial class Classname : CombatRoutine
    {

        public bool flameschok()
        {
            if (gotTarget
                 && SpellManager.HasSpell(FlameShock)
                 && buffTimeLeft(FlameShock, Me.CurrentTarget) < 3000
                 && !spellOnCooldown(FlameShock)
                 && LastSpellID != FlameShock
                 && !Me.IsCasting)
                { 
                    return true;
                }
            return false;
        }
        public bool lavaburstAscendance()
        {
            if(gotTarget
                && buffExists(Ascendance, Me)) 
            {
                return true;
            }
            return false;
        }
        public bool lavaburst()
        {
            if (gotTarget
                    && SpellManager.HasSpell(LavaBurst)
                    && !spellOnCooldown(LavaBurst)
                    && !Me.IsCasting)
            {
                return true;
            }
            return false;
        }
        public bool unleashelements()
        {
            if (gotTarget
                && SpellManager.HasSpell(UnleashElements)
                && !spellOnCooldown(UnleashElements)
                && (!spellOnCooldown(LavaBurst)
                || buffExists(Ascendance, Me))
                && !Me.IsCasting)
                 
                {
                    return true;
                }
            return false;
        }
        public bool earthshock()
        {
            if (gotTarget
                    && SpellManager.HasSpell(EarthShock)
                    && !spellOnCooldown(EarthShock)
                    && !Me.HasAura("Ascendance")
                    && buffExists(LightningShield, Me)
                    && buffStackCount(LightningShield, Me) > 6
                    && LastSpellID != EarthShock
                    && !Me.IsCasting)
            {
                return true;
            }
            return false;
        }
        public bool ascendance()
        {
            if (gotTarget
                && SpellManager.HasSpell(Ascendance)
                && !AscendanceOn
                && !spellOnCooldown(Ascendance)
                && UseAscendance
                && LastSpellID != Ascendance
                && !Me.IsCasting)
            {
                return true;
            }
            return false;
        }
        public bool windshear()
        {
            if (gotTarget
                    && SpellManager.HasSpell(WindShear)
                    && !Me.HasAura("Ascendance")
                    && !spellOnCooldown(WindShear)
                    && (Me.CurrentTarget.IsCasting
                    && Me.CanInterruptCurrentSpellCast)
                    && !Me.IsCasting)
            {
                return true;
            }
            return false;
        }
        public bool fireElementalTotem()
        {
            if (gotTarget
                && !Me.HasAura("Ascendance")
                && SpellManager.HasSpell(FireElementalTotem)
                && !spellOnCooldown(FireElementalTotem)
                && ((ShammySettings.myPrefs.fireelementaltotem == 1 && IsBoss)
                || ShammySettings.myPrefs.fireelementaltotem == 2)
                && targetExistence(Me.CurrentTarget) >= 25
                && LastSpellID != FireElementalTotem
                && !Me.IsCasting)
            {
                return true;
            }
            return false;
        }
        public bool earthElementalTotem()
        {
            if (gotTarget
                && !Me.HasAura("Ascendance")
                && SpellManager.HasSpell(EarthElementalTotem)
                && !spellOnCooldown(EarthElementalTotem)
                && useEartElementalTotem
                && ((ShammySettings.myPrefs.earthelementaltotem == 1 && IsBoss)
                || ShammySettings.myPrefs.earthelementaltotem == 2)
                && targetExistence(Me.CurrentTarget) >= 25
                && LastSpellID != EarthElementalTotem
                && !Me.IsCasting)
            {
                return true;
            }
            return false;
        }
        public bool searingTotem()
        {
            if (gotTarget
                && !Me.HasAura("Ascendance")
                && SpellManager.HasSpell(SearingTotem)
                && UseSearingTotem
                && !Me.IsCasting)
            {
                return true;
            }
            return false;
        }
        public bool healingStreamTotem()
        {
            if (gotTarget
                && !Me.HasAura("Ascendance")
                && SpellManager.HasSpell(HealingStreamTotem)
                && !spellOnCooldown(HealingStreamTotem)
                && ShammySettings.myPrefs.HealingStreamTotem == 0
                && targetExistence(Me.CurrentTarget) >= 10
                && Me.HealthPercent <= 80)
            {
                return true;
            }
            return false;
        }
        public bool thunderstorm()
        {
            if (gotTarget
                && !Me.HasAura("Ascendance")
                && SpellManager.HasSpell(Thunderstorm)
                && !Me.CurrentTarget.HasAura(Thunderstorm)
                && !spellOnCooldown(Thunderstorm)
                && ShammySettings.myPrefs.thunderstorm == 1
                && nearbyTargets(Me.CurrentTarget.Location, 10).Count() > 1
                && !Me.IsCasting)
            {
                return true;
            }
            return false;
        }
        public bool bloodfury()
        {
            if (gotTarget
                && SpellManager.HasSpell(BloodFury)
                && !spellOnCooldown(BloodFury)
                && UseBloodFury)
            {
                return true;
            }
            return false;
        }
        public bool berserking()
        {
            if (gotTarget 
                && SpellManager.HasSpell(Berserking)
                && !spellOnCooldown(Berserking)
                && !Me.HasAura("Bloodlust")
                && !Me.HasAura("Time Warp")
                && !Me.HasAura("Heroism")
                && UseBerserking)
            {
                return true;
            }
            return false;
        }
        public bool lifeblood()
        {
            if (gotTarget
                && !Me.HasAura("Ascendance")
                && SpellManager.HasSpell(Lifeblood)
                && !Me.HasAura("Bloodlust")
                && !Me.HasAura("Time Warp")
                && !Me.HasAura("Heroism")
                && !spellOnCooldown(Lifeblood)
                && ShammySettings.myPrefs.lifebloodYorN == 1
                && (ShammySettings.myPrefs.lifeblood == 0 
                || (ShammySettings.myPrefs.lifeblood == 1
                && IsBoss)))
            {
                return true;
            }

            return false;
        }
        public bool elementalblast()
        {
            if (gotTarget
                && !Me.HasAura("Ascendance")
                && SpellManager.HasSpell(ElementalBlast)
                && !spellOnCooldown(ElementalBlast)
                && targetExistence(Me.CurrentTarget) >= 10)
            {
                return true;
            }
            return false;
        }
        public bool lightningbolt()
        {
            if (gotTarget 
                && SpellManager.HasSpell(LightningBolt)
                && !Me.HasAura("Ascendance")
                && spellOnCooldown(LavaBurst)
                && !Me.IsCasting)
            {
                return true;
            }
            return false;
        }
        public bool earthquake()
        {
            if (gotTarget
                && !Me.HasAura("Ascendance")
                && SpellManager.HasSpell(Earthquake)
                && !spellOnCooldown(Earthquake)
                && UseEarthquake
                && !Me.IsCasting)
            {
                return true;
            }
            return false;
        }
        public bool chainlightning()
        {
            if (gotTarget 
                && SpellManager.HasSpell(ChainLightning)
                && !spellOnCooldown(ChainLightning)
                && !Me.IsCasting)
            {
                return true;
            }
            return false;
        }
        public bool chainlightningAscendance()
        {
            if (gotTarget
                && Me.HasAura("Ascendance")
                && SpellManager.HasSpell(ChainLightning)
                && !spellOnCooldown(ChainLightning)
                && !Me.IsCasting)
            {
                return true;
            }
            return false;
        }
        public bool magmatotem()
        {
            if (gotTarget
                && !Me.HasAura("Ascendance")
                && SpellManager.HasSpell(MagmaTotem)
                && UseMagmaTotem)
            {
                return true;
            }
            return false;
        }
        public bool autoAttacking()
        {
            if (gotTarget
                && !Me.IsAutoAttacking)
            {
                return true;
            }
            return false;
        }
        public bool shamanisticrage()
        {
            if (gotTarget
                 && SpellManager.HasSpell(ShamanisticRage)
                 && !spellOnCooldown(ShamanisticRage)
                 && NeedShamanisticRage)
            {
                return true;
            }
            return false;
        }
    }
}
